package com.just.bz_back.exception;

import com.just.bz_back.model.dto.JsonData;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import java.sql.SQLException;


@ControllerAdvice
public class MyException  {

    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    @ExceptionHandler(value = SQLException.class)
    public JsonData ExceptHelder()
    {
        return JsonData.buildError("服务器异常！",500);
    }

}
